import { Component, Vue } from 'vue-property-decorator';
import { mixinViewDialog } from "@/mixin/view/Dialog";
import { mixinViewForm } from "@/mixin/view/Form";
import { limiting } from '@/utils/Annotate'
@Component({
    mixins: [mixinViewDialog, mixinViewForm]
})
export class mixinDialogForm extends Vue {
    // 是否修改模式
    // 提交表单会根据此配置调用不同的方法去提交数据
    // true 修改，调用this.itemEdit
    // false 新建，调用this.itemAdd
    isEdit: boolean = false;
    // 是否详情模式
    isInfo: boolean = false;

    submitFormSuccess(data: any) {
        const me = this as any;
        me.submitSuccess(me.$vnode.data.ref, data);
    }

    /**
     * 关闭弹窗
     *
     * @param {string} [refName='form'] 表单ref
     * @memberof mixinDialogForm
     */
    @limiting(500)
    onDialogClose(refName: any = 'form') {
        const me = this as any;
        // 重置表单数据
        me.resetForm(refName);
        me.superOnDialogClose();
    }
}
